README File for "Observational Equivalence in Explaining Attitude Change: Have White Racial Attitudes Genuinely Changed?"
by Allison P. Anoll and Andrew M. Engelhardt
February 28, 2023
British Journal of Political science

#############
#
# Overview
# 
#############

This README file provides an inventory of all code used in the analysis, as well as a guide for finding code associated with each table and statistic in the paper. It also contains cleaning files to prep the data sets used in the analyses. See notes on cleaning files for potential computing limitations given required RAM to include data sets into working memory.

#############

#############
#
# Software
#
#############
Analyses were conducted in the following computing environment.

OSX 10.15.7
R version 4.2.1

Add-on R Libraries for main text analyses:    
- cem_1.1.31
- lattice_0.20-45
- marginaleffects_0.7.1
- numform_0.7.0
- stargazer_5.2.3
- patchwork_1.1.2      - reshape_0.8.9
- ggplot2_3.3.6 

Add-on R Libraries for appendix analyses:
- stargazer_5.2.3
- xtable_1.8-4  
- lavaan_0.6-12
- cem_1.1.31
- lattice_0.20-45
- psych_2.2.9 


Note: packages may require additional dependencies not specified.


The code was checked on a computer running:
OSX OSX 10.15.7
R version 4.1.1


#############
#
# Notes on Code
#
#############
Files with a leading 0 contain utility functions (09).

Users can run the code in files beginning with "10" to reproduce the figures and other results reported in the main text. They rely on the analysis data sets. Files with a "20" prefix produces the tables and other results reported for supplementary analyses in the appendix. These files are labeled separately by the relevant appendix (A1 = Appendix 1).

Within scripts, code is organized sequentially based on reporting of the relevant analyses in the paper, with descriptive headings calling out each study and subheadings noting specific steps. The respective sections also contain code for reported tests or other values discussed in the text in relation to that table or figure. 

Figures and table components are saved into a user's working directory. Tables are printed into the console text for visualization, but uncommenting the file path and commenting this "type" argument 

Specific files are as follows:

Function code files (09*)
- 09_hetReg
Functions provided by Charles Franklin to estimate heteroskedastic regression


Analysis files (Main Text)
- 10_main.R
Script file to run the analyses reported in the article's main text.

Analysis files (Supplemental/Appendix)
- 20_A1.R
Script file containing commands for supplementary analyses to main text models reported in appendix.

#############
#
# Notes on Data
#
#############
The analyses use the following data set:
1. Anoll, Allison P. and Mackenzie Israel-Trummel. 2017. “The Race and Carceral State Survey.” https://allisonanoll.com/data/